

<%@ page import="clothing.database.EmployeeManager"%>

<%@ page import="clothing.database.Employee"%>

<%@ page import="java.util.ArrayList"%>



<%@ include file="templates/header.jsp"%>



<h3>Employee Page</h3>

<script>

function process(a)

{

	var con = confirm("Are you sure you want to delete this employee?");

	if(con==true)

	{

		document.getElementById('id').value=a;

		document.myform.submit();

	}

}  



function processedit(a)

{

	document.getElementById('id2').value=a;

	document.myform2.submit();	

	







}  

</script>

		<%@ include file="templates/main_nav.jsp" %>

<%

	EmployeeManager uh = new EmployeeManager();

	ArrayList<Employee> list = uh.getList();

	

	out.println("<form name =\"myform\" id=\"myform\" action =\"deleteEmployee.jsp\" method=\"post\">");

	out.println("<table>");

%>

<tr>

	<td><strong>ID</strong></td>

	<td><strong>Firstname</strong></td>

	<td><strong>MI</strong></td>

	<td><strong>LastName</strong></td>

	<td><strong>Phone</strong></td>

	<td><strong>Address</strong></td>

	<td><strong>Username</strong></td>

	<td><strong>Password</strong></td>

	<td><strong>Type</strong></td>

</tr>

<input type="hidden" name="id" id="id" />



<%

				for(int i=0;i<list.size();i++)

				{

					out.println("<tr>");

					Employee current = list.get(i);

				out.println("<td>"+ current.getId()+"</td>");

				out.println("<td>"+ current.getFirstName()+"</td>");

				out.println("<td>"+ current.getMI()+"</td>");

				out.println("<td>"+ current.getLastName()+"</td>");

				out.println("<td>"+ current.getPhone()+"</td>");

				out.println("<td>"+ current.getAddress()+"</td>");

				out.println("<td>"+ current.getUsername()+"</td>");

				out.println("<td>"+ current.getPassword()+"</td>");

				out.println("<td>"+ current.getType()+"</td>");

				

			%>



<td><input type="button" value="Delete" onclick="process(<%=current.getId() %>);" /></td>

<td><input type="button" value="Edit" onclick="processedit(<%=current.getId() %>);" /></td>

<% 

		out.println("</tr>");

	}

	



	out.println("</table></form>");

	

	

%>

<form name="myform2" id="myform2" action="editEmployee.jsp" method="post">

<input type="hidden" name="id2" id="id2" />

</form>



<h2>Add an Employee</h2>



<table>

<form action="addEmployee.jsp" method="post">

	<tr>

		<td>First Name:</td>

		<td><input type="text" name="firstname" /></td>

	</tr>



	<tr>

		<td>MI :</td>

		<td><input type="text" size="1" name="mi" /></td>

	</tr>



	<tr>

		<td>Last Name:</td>

		<td><input type="text" name="lastname" /></td>

	</tr>



	<tr>

		<td>Phone:</td>

		<td><input type="text" name="phone" /></td>

	</tr>



	<tr>

		<td>Address :</td>

		<td><input type="text" name="address" /></td>

	</tr>



	<tr>

		<td>Username:</td>

		<td><input type="text" name="username" /></td>

	</tr>



	<tr>

		<td>Password:</td>

		<td><input type="password" name="password" /></td>

	</tr>



	<tr>

		<td>Type:</td>

		<td>

                   <select name="type" />

                   <option value="Employee">Employee</option>

                   <option value="Manager">Manager</option>

                   </select>

                   

            </td>

	</tr>



	<tr>

		<td></td>

		<td><input type="submit" value="submit" /></td>

	</tr>

	

</table>





<%@ include file="templates/footer.jsp"%>

